package at.horario.model;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.LocalTime;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;


@Embeddable
public class SdpsmovId  implements Serializable {

    @Column(name = "PSMENT", length = 5)
    private String psment;

    @Column(name = "PSMREF", length = 16)
    private String psmref;

    @Column(name = "PSMVLR", length = 15, precision = 2)
    private BigDecimal psmvlr;

    @Column(name = "PSUSER", length = 10)
    private String psuser;

    @Column(name = "PSWKST", length = 10)
    private String pswkst;

    @Column(name = "PSDATA", length = 8)
    @Type(type = "at.horario.model.types.DateType")
    private LocalDate psdata;

    @Column(name = "PSHORA", length = 6)
    @Type(type = "at.horario.model.types.TimeType")
    private LocalTime pshora;

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SdpsmovId sdpsmovId = (SdpsmovId) o;

        if (psdata != null ? !psdata.equals(sdpsmovId.psdata) : sdpsmovId.psdata != null) return false;
        if (pshora != null ? !pshora.equals(sdpsmovId.pshora) : sdpsmovId.pshora != null) return false;
        if (psment != null ? !psment.equals(sdpsmovId.psment) : sdpsmovId.psment != null) return false;
        if (psmref != null ? !psmref.equals(sdpsmovId.psmref) : sdpsmovId.psmref != null) return false;
        if (psmvlr != null ? !psmvlr.equals(sdpsmovId.psmvlr) : sdpsmovId.psmvlr != null) return false;
        if (psuser != null ? !psuser.equals(sdpsmovId.psuser) : sdpsmovId.psuser != null) return false;
        if (pswkst != null ? !pswkst.equals(sdpsmovId.pswkst) : sdpsmovId.pswkst != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (psment != null ? psment.hashCode() : 0);
        result = 31 * result + (psmref != null ? psmref.hashCode() : 0);
        result = 31 * result + (psmvlr != null ? psmvlr.hashCode() : 0);
        result = 31 * result + (psuser != null ? psuser.hashCode() : 0);
        result = 31 * result + (pswkst != null ? pswkst.hashCode() : 0);
        result = 31 * result + (psdata != null ? psdata.hashCode() : 0);
        result = 31 * result + (pshora != null ? pshora.hashCode() : 0);
        return result;
    }

    public String getPsment() {
        return psment;
    }

    public void setPsment(String psment) {
        this.psment = psment;
    }

    public String getPsmref() {
        return psmref;
    }

    public void setPsmref(String psmref) {
        this.psmref = psmref;
    }

    public BigDecimal getPsmvlr() {
        return psmvlr;
    }

    public void setPsmvlr(BigDecimal psmvlr) {
        this.psmvlr = psmvlr;
    }

    public String getPsuser() {
        return psuser;
    }

    public void setPsuser(String psuser) {
        this.psuser = psuser;
    }

    public String getPswkst() {
        return pswkst;
    }

    public void setPswkst(String pswkst) {
        this.pswkst = pswkst;
    }

    public LocalDate getPsdata() {
        return psdata;
    }

    public void setPsdata(LocalDate psdata) {
        this.psdata = psdata;
    }

    public LocalTime getPshora() {
        return pshora;
    }

    public void setPshora(LocalTime pshora) {
        this.pshora = pshora;
    }
}